package com.itxx.anonymousAndLambda.test2;

public class FlyTest {
    public static void main(String[] args) {
        getFly().fly();
        useFly(new Flyable() {
            @Override
            public void fly() {
                System.out.println("可以飞111");
            }
        });
        //用lambda优化
        useFly(() -> {
            System.out.println("用lambda优化");
        });

//        Flyable flayable = new Tast();
    }

    public static void useFly(Flyable flayable) {
        flayable.fly();
    }

    public static Flyable getFly() {
        return new Flyable() {
            @Override
            public void fly() {
                System.out.println("可以飞");
            }
        };
    }


     /*static class Tast implements Flyable{
        @Override
        public void fly() {

        }
    }*/
}